package org.processmining.plugins.complianceframework;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.deckfour.xes.model.XLog;
import org.processmining.contexts.uitopia.UIPluginContext;
import org.processmining.contexts.uitopia.annotations.UITopiaVariant;
import org.processmining.framework.plugin.annotations.Plugin;
import org.processmining.models.graphbased.directed.petrinetwithdata.newImpl.PetriNetWithData;

public class ProblemInsightPlugin {
	@Plugin(name = "Get problem insight", parameterLabels = { "Compliance dashboard" }, returnLabels = { "Trained classificator"}, returnTypes = {InstanceClassificatior.class})
	@UITopiaVariant(affiliation = UITopiaVariant.EHV, author = "V. Gromov", email = "v.gromov@student.tue.nl")
	public InstanceClassificatior getDeviationOverview(UIPluginContext context,
			ComplianceDashboard dashboard) {
		Map<String, List<String>> attributeAssignments = new HashMap<String, List<String>>();
		List<String> values = new ArrayList<String>();
		values.add("1");
		attributeAssignments.put("AMOUNT_REQ", values);
		List<String> activitiesProblems = new ArrayList<String>();
		activitiesProblems.add("O_SELECTED");
		Map<String, List<String>> attributePossibleVals = new HashMap<String, List<String>>();
		for (String attribute : dashboard.getAttributeMovesMap().keySet()) {
			attributePossibleVals.put(attribute, new ArrayList<String>());
			for (String attrValue : dashboard.getAttributeMovesMap()
					.get(attribute).keySet()) {
				attributePossibleVals.get(attribute).add(attrValue);
			}
		}
		InstanceClassificatior classificator = new InstanceClassificatior(
				dashboard, attributeAssignments,
				activitiesProblems, attributePossibleVals,
				dashboard.getIntervals());
		
		return classificator;
	}
}
